﻿
package com.victim.snake.graphics.roomClass
{
	import flash.display.Bitmap;	
	import flash.events.Event;
	import flash.events.EventDispatcher;
	import com.victim.snake.util.Loader;
	import flash.display.LoaderInfo;


	//房间各种图片下载
	public class ImageLoader extends EventDispatcher{
		
		public var roomBackground:Bitmap=null;	//房间界面背景
		public var startUpButton:Bitmap=null;	//开始按钮
		public var readyUpButton:Bitmap=null;	//准备按钮
		public var unReadyUpButton:Bitmap=null;	//取消准备按钮
		public var leaveUpButton:Bitmap=null;	//离开房间按钮
		
		public var groupRedUp:Bitmap=null;	//红队按钮平时状态
		public var groupRedOver:Bitmap=null;	//红队按钮鼠标在其之上状态
		public var groupRedDown:Bitmap=null;	//红队按钮按下状态
		
		public var groupGreenUp:Bitmap=null;	//绿红队按钮平时状态
		public var groupGreenOver:Bitmap=null;	//绿队按钮鼠标在其之上状态
		public var groupGreenDown:Bitmap=null;	//绿队按钮按下状态
		
		public var groupYellowUp:Bitmap=null;	//黄队按钮平时状态
		public var groupYellowOver:Bitmap=null;	//黄队按钮鼠标在其之上状态
		public var groupYellowDown:Bitmap=null;	//黄队按钮按下状态
		
		public var groupBlueUp:Bitmap=null;	//蓝队按钮平时状态
		public var groupBlueOver:Bitmap=null;	//蓝队按钮鼠标在其之上状态
		public var groupBlueDown:Bitmap=null;	//蓝队按钮按下状态
		
		//私有构造函数
		public function ImageLoader():void{}
		
		
		
		
		
		//下载离开房间按钮
		public function leaveUpButtonLoader():void{
			if(this.leaveUpButton==null){
				new Loader("image/room/leave.png",leaveUpButtonLoaderEvent);	
			}else{
				var imageLoaderEvent:ImageLoaderEvent=new ImageLoaderEvent(ImageLoaderEvent.LeaveUpButtonLoader,this.leaveUpButton);
				this.dispatchEvent(imageLoaderEvent);
			}
		}
		
		
		//下载房间界面背景
		public function roomBackgroundLoader():void{
			if(this.roomBackground==null){
				new Loader("image/room/roomBackground.jpg",roomBackgroundLoaderEvent);	
			}else{
				var imageLoaderEvent:ImageLoaderEvent=new ImageLoaderEvent(ImageLoaderEvent.RoomBackgroundIsLoader,this.roomBackground);
				this.dispatchEvent(imageLoaderEvent);
			}
		}
		
		//下载开始按钮
		public function startUpButtonLoader():void{
			if(this.startUpButton==null){
				new Loader("image/room/roomStart.png",startUpButtonLoaderEvent);	
			}else{
				var imageLoaderEvent:ImageLoaderEvent=new ImageLoaderEvent(ImageLoaderEvent.RoomStartUpButtonIsLoader,this.startUpButton);
				this.dispatchEvent(imageLoaderEvent);
			}
		}
		
		//下载准备按钮
		public function readyUpButtonLoader():void{
			if(this.readyUpButton==null){
				new Loader("image/room/roomReady.png",readyUpButtonLoaderEvent);	
			}else{
				var imageLoaderEvent:ImageLoaderEvent=new ImageLoaderEvent(ImageLoaderEvent.RoomReadyUpButtonIsLoader,this.readyUpButton);
				this.dispatchEvent(imageLoaderEvent);
			}
		}
		
		//下载取消按钮
		public function unReadyUpButtonLoader():void{
			if(this.unReadyUpButton==null){
				new Loader("image/room/roomUnReady.png",unReadyUpButtonLoaderEvent);	
			}else{
				var imageLoaderEvent:ImageLoaderEvent=new ImageLoaderEvent(ImageLoaderEvent.RoomUnReadyUpButtonIsLoader,this.unReadyUpButton);
				this.dispatchEvent(imageLoaderEvent);
			}
		}
		
		//下载红队按钮平时状态
		public function groupRedUpButtonLoader():void{
			if(this.groupRedUp==null){
				new Loader("image/room/groupRedUp.png",groupRedUpButtonLoaderEvent);	
			}else{
				var imageLoaderEvent:ImageLoaderEvent=new ImageLoaderEvent(ImageLoaderEvent.GroupRedUp,this.groupRedUp);
				this.dispatchEvent(imageLoaderEvent);
			}
		}
		//下载红队按钮over状态
		public function groupRedOverButtonLoader():void{
			if(this.groupRedOver==null){
				new Loader("image/room/groupRedOver.png",groupRedOverButtonLoaderEvent);	
			}else{
				var imageLoaderEvent:ImageLoaderEvent=new ImageLoaderEvent(ImageLoaderEvent.GroupRedOver,this.groupRedOver);
				this.dispatchEvent(imageLoaderEvent);
			}
		}
		//下载红队按钮down状态
		public function groupRedDownButtonLoader():void{
			if(this.groupRedDown==null){
				new Loader("image/room/groupRedDown.png",groupRedDownButtonLoaderEvent);	
			}else{
				var imageLoaderEvent:ImageLoaderEvent=new ImageLoaderEvent(ImageLoaderEvent.GroupRedDown,this.groupRedDown);
				this.dispatchEvent(imageLoaderEvent);
			}
		}
		//下载绿队按钮平时状态
		public function groupGreenUpButtonLoader():void{
			if(this.groupGreenUp==null){
				new Loader("image/room/groupGreenUp.png",groupGreenUpButtonLoaderEvent);	
			}else{
				var imageLoaderEvent:ImageLoaderEvent=new ImageLoaderEvent(ImageLoaderEvent.GroupGreenUp,this.groupGreenUp);
				this.dispatchEvent(imageLoaderEvent);
			}
		}
		//下载绿队按钮over状态
		public function groupGreenOverButtonLoader():void{
			if(this.groupGreenOver==null){
				new Loader("image/room/groupGreenOver.png",groupGreenOverButtonLoaderEvent);	
			}else{
				var imageLoaderEvent:ImageLoaderEvent=new ImageLoaderEvent(ImageLoaderEvent.GroupGreenOver,this.groupGreenOver);
				this.dispatchEvent(imageLoaderEvent);
			}
		}
		//下载绿队按钮down状态
		public function groupGreenDownButtonLoader():void{
			if(this.groupGreenDown==null){
				new Loader("image/room/groupGreenDown.png",groupGreenDownButtonLoaderEvent);	
			}else{
				var imageLoaderEvent:ImageLoaderEvent=new ImageLoaderEvent(ImageLoaderEvent.GroupGreenDown,this.groupGreenDown);
				this.dispatchEvent(imageLoaderEvent);
			}
		}
		//下载黄队按钮平时状态
		public function groupYellowUpButtonLoader():void{
			if(this.groupYellowUp==null){
				new Loader("image/room/groupYellowUp.png",groupYellowUpButtonLoaderEvent);	
			}else{
				var imageLoaderEvent:ImageLoaderEvent=new ImageLoaderEvent(ImageLoaderEvent.GroupYellowUp,this.groupYellowUp);
				this.dispatchEvent(imageLoaderEvent);
			}
		}
		//下载黄队按钮over状态
		public function groupYellowOverButtonLoader():void{
			if(this.groupYellowOver==null){
				new Loader("image/room/groupYellowOver.png",groupYellowOverButtonLoaderEvent);	
			}else{
				var imageLoaderEvent:ImageLoaderEvent=new ImageLoaderEvent(ImageLoaderEvent.GroupYellowOver,this.groupYellowOver);
				this.dispatchEvent(imageLoaderEvent);
			}
		}
		//下载黄队按钮down状态
		public function groupYellowDownButtonLoader():void{
			if(this.groupYellowDown==null){
				new Loader("image/room/groupYellowDown.png",groupYellowDownButtonLoaderEvent);	
			}else{
				var imageLoaderEvent:ImageLoaderEvent=new ImageLoaderEvent(ImageLoaderEvent.GroupYellowDown,this.groupYellowDown);
				this.dispatchEvent(imageLoaderEvent);
			}
		}
		//下载蓝队按钮平时状态
		public function groupBlueUpButtonLoader():void{
			if(this.groupBlueUp==null){
				new Loader("image/room/groupBlueUp.png",groupBlueUpButtonLoaderEvent);	
			}else{
				var imageLoaderEvent:ImageLoaderEvent=new ImageLoaderEvent(ImageLoaderEvent.GroupBlueUp,this.groupBlueUp);
				this.dispatchEvent(imageLoaderEvent);
			}
		}
		//下载蓝队按钮over状态
		public function groupBlueOverButtonLoader():void{
			if(this.groupBlueOver==null){
				new Loader("image/room/groupBlueOver.png",groupBlueOverButtonLoaderEvent);	
			}else{
				var imageLoaderEvent:ImageLoaderEvent=new ImageLoaderEvent(ImageLoaderEvent.GroupBlueOver,this.groupBlueOver);
				this.dispatchEvent(imageLoaderEvent);
			}
		}
		//下载蓝队按钮down状态
		public function groupBlueDownButtonLoader():void{
			if(this.groupYellowDown==null){
				new Loader("image/room/groupBlueDown.png",groupBlueDownButtonLoaderEvent);	
			}else{
				var imageLoaderEvent:ImageLoaderEvent=new ImageLoaderEvent(ImageLoaderEvent.GroupBlueDown,this.groupBlueDown);
				this.dispatchEvent(imageLoaderEvent);
			}
		}
		
		
		
		
		
		
		
		
		
		
		
		
		
		//离开房间按钮下载完成
		 private function leaveUpButtonLoaderEvent(e:Event):void{
			var loaderInfo:LoaderInfo=LoaderInfo(e.target);
			this.leaveUpButton=Bitmap(loaderInfo.content);
			var imageLoaderEvent:ImageLoaderEvent=new ImageLoaderEvent(ImageLoaderEvent.LeaveUpButtonLoader,this.leaveUpButton);
			this.dispatchEvent(imageLoaderEvent);
		}
		
		//房间界面背景下载完成
		 private function roomBackgroundLoaderEvent(e:Event):void{
			var loaderInfo:LoaderInfo=LoaderInfo(e.target);
			this.roomBackground=Bitmap(loaderInfo.content);
			var imageLoaderEvent:ImageLoaderEvent=new ImageLoaderEvent(ImageLoaderEvent.RoomBackgroundIsLoader,this.roomBackground);
			this.dispatchEvent(imageLoaderEvent);
		}
		
		//开始按钮下载完成
		 private function startUpButtonLoaderEvent(e:Event):void{
			var loaderInfo:LoaderInfo=LoaderInfo(e.target);
			this.startUpButton=Bitmap(loaderInfo.content);
			var imageLoaderEvent:ImageLoaderEvent=new ImageLoaderEvent(ImageLoaderEvent.RoomStartUpButtonIsLoader,this.startUpButton);
			this.dispatchEvent(imageLoaderEvent);
		}
		
		//准备按钮下载完成
		 private function readyUpButtonLoaderEvent(e:Event):void{
			var loaderInfo:LoaderInfo=LoaderInfo(e.target);
			this.readyUpButton=Bitmap(loaderInfo.content);
			var imageLoaderEvent:ImageLoaderEvent=new ImageLoaderEvent(ImageLoaderEvent.RoomReadyUpButtonIsLoader,this.readyUpButton);
			this.dispatchEvent(imageLoaderEvent);
		}
		
		//取消准备按钮下载完成
		 private function unReadyUpButtonLoaderEvent(e:Event):void{
			var loaderInfo:LoaderInfo=LoaderInfo(e.target);
			this.unReadyUpButton=Bitmap(loaderInfo.content);
			var imageLoaderEvent:ImageLoaderEvent=new ImageLoaderEvent(ImageLoaderEvent.RoomUnReadyUpButtonIsLoader,this.unReadyUpButton);
			this.dispatchEvent(imageLoaderEvent);
		}
		
		//红队按钮平时状态下载完成
		 private function groupRedUpButtonLoaderEvent(e:Event):void{
			var loaderInfo:LoaderInfo=LoaderInfo(e.target);
			this.groupRedUp=Bitmap(loaderInfo.content);
			var imageLoaderEvent:ImageLoaderEvent=new ImageLoaderEvent(ImageLoaderEvent.GroupRedUp,this.groupRedUp);
			this.dispatchEvent(imageLoaderEvent);
		}
		
		//红队按钮over状态下载完成
		 private function groupRedOverButtonLoaderEvent(e:Event):void{
			var loaderInfo:LoaderInfo=LoaderInfo(e.target);
			this.groupRedOver=Bitmap(loaderInfo.content);
			var imageLoaderEvent:ImageLoaderEvent=new ImageLoaderEvent(ImageLoaderEvent.GroupRedOver,this.groupRedOver);
			this.dispatchEvent(imageLoaderEvent);
		}
		
		//红队按钮over状态下载完成
		 private function groupRedDownButtonLoaderEvent(e:Event):void{
			var loaderInfo:LoaderInfo=LoaderInfo(e.target);
			this.groupRedDown=Bitmap(loaderInfo.content);
			var imageLoaderEvent:ImageLoaderEvent=new ImageLoaderEvent(ImageLoaderEvent.GroupRedDown,this.groupRedDown);
			this.dispatchEvent(imageLoaderEvent);
		}
				
		//绿队按钮平时状态下载完成
		 private function groupGreenUpButtonLoaderEvent(e:Event):void{
			var loaderInfo:LoaderInfo=LoaderInfo(e.target);
			this.groupGreenUp=Bitmap(loaderInfo.content);
			var imageLoaderEvent:ImageLoaderEvent=new ImageLoaderEvent(ImageLoaderEvent.GroupGreenUp,this.groupGreenUp);
			this.dispatchEvent(imageLoaderEvent);
		}
		
		//绿队按钮over状态下载完成
		 private function groupGreenOverButtonLoaderEvent(e:Event):void{
			var loaderInfo:LoaderInfo=LoaderInfo(e.target);
			this.groupGreenOver=Bitmap(loaderInfo.content);
			var imageLoaderEvent:ImageLoaderEvent=new ImageLoaderEvent(ImageLoaderEvent.GroupGreenOver,this.groupGreenOver);
			this.dispatchEvent(imageLoaderEvent);
		}
		
		//绿队按钮down状态下载完成
		 private function groupGreenDownButtonLoaderEvent(e:Event):void{
			var loaderInfo:LoaderInfo=LoaderInfo(e.target);
			this.groupGreenDown=Bitmap(loaderInfo.content);
			var imageLoaderEvent:ImageLoaderEvent=new ImageLoaderEvent(ImageLoaderEvent.GroupGreenDown,this.groupGreenDown);
			this.dispatchEvent(imageLoaderEvent);
		}
		
		//黄队按钮平时状态下载完成
		 private function groupYellowUpButtonLoaderEvent(e:Event):void{
			var loaderInfo:LoaderInfo=LoaderInfo(e.target);
			this.groupYellowUp=Bitmap(loaderInfo.content);
			var imageLoaderEvent:ImageLoaderEvent=new ImageLoaderEvent(ImageLoaderEvent.GroupYellowUp,this.groupYellowUp);
			this.dispatchEvent(imageLoaderEvent);
		}
		
		//黄队按钮over状态下载完成
		 private function groupYellowOverButtonLoaderEvent(e:Event):void{
			var loaderInfo:LoaderInfo=LoaderInfo(e.target);
			this.groupYellowOver=Bitmap(loaderInfo.content);
			var imageLoaderEvent:ImageLoaderEvent=new ImageLoaderEvent(ImageLoaderEvent.GroupYellowOver,this.groupYellowOver);
			this.dispatchEvent(imageLoaderEvent);
		}
		
		//黄队按钮down状态下载完成
		 private function groupYellowDownButtonLoaderEvent(e:Event):void{
			var loaderInfo:LoaderInfo=LoaderInfo(e.target);
			this.groupYellowDown=Bitmap(loaderInfo.content);
			var imageLoaderEvent:ImageLoaderEvent=new ImageLoaderEvent(ImageLoaderEvent.GroupYellowDown,this.groupYellowDown);
			this.dispatchEvent(imageLoaderEvent);
		}
		
		//蓝队按钮平时状态下载完成
		 private function groupBlueUpButtonLoaderEvent(e:Event):void{
			var loaderInfo:LoaderInfo=LoaderInfo(e.target);
			this.groupBlueUp=Bitmap(loaderInfo.content);
			var imageLoaderEvent:ImageLoaderEvent=new ImageLoaderEvent(ImageLoaderEvent.GroupBlueUp,this.groupBlueUp);
			this.dispatchEvent(imageLoaderEvent);
		}
		
		//蓝队按钮over状态下载完成
		 private function groupBlueOverButtonLoaderEvent(e:Event):void{
			var loaderInfo:LoaderInfo=LoaderInfo(e.target);
			this.groupBlueOver=Bitmap(loaderInfo.content);
			var imageLoaderEvent:ImageLoaderEvent=new ImageLoaderEvent(ImageLoaderEvent.GroupBlueOver,this.groupBlueOver);
			this.dispatchEvent(imageLoaderEvent);
		}
		
		//蓝队按钮down状态下载完成
		 private function groupBlueDownButtonLoaderEvent(e:Event):void{
			var loaderInfo:LoaderInfo=LoaderInfo(e.target);
			this.groupBlueDown=Bitmap(loaderInfo.content);
			var imageLoaderEvent:ImageLoaderEvent=new ImageLoaderEvent(ImageLoaderEvent.GroupBlueDown,this.groupBlueDown);
			this.dispatchEvent(imageLoaderEvent);
		}
	}

}